using System;
using System.IO;
using System.IO.Compression;
using System.Net;
using BookDownloader.Core.Implementation.Flibusta;

namespace BookDownloader.Core.Implementation.BaseLibEngine.Parser
{
	public abstract class SqlWebStreamProviderBase : ISqlStreamProvider
	{
		public StreamReader GetReader(LibFileTypes fileType)
		{
			Uri uri = GetUri(fileType);
			WebClient client = new WebClient();
			GZipStream stream = new GZipStream(client.OpenRead(uri),CompressionMode.Decompress);
			StreamReader sr = new StreamReader(stream);
			return sr;
		}

		protected virtual Uri GetUri(LibFileTypes fileType)
		{
			return null;
		}
	}
}